package com.giraffe.mqtt.utils;

import org.springframework.util.StringUtils;

import java.util.Optional;

/**
 * @Author ldx
 * @Date 2024/01/16 15:23
 **/
public class TopicUtils {
    private final static String SPLITOR = "/";

    public static String[] getTopic(String topic) {
        return Optional.ofNullable(topic).map(s ->
                StringUtils.split(topic, SPLITOR)
        ).orElse(null);
    }

}
